<include file="Public/min-header"/>
<div class="wrapper">
  <include file="Public/breadcrumb"/>
  <!-- Main content -->
  <section class="content">
    <div class="container-fluid">
      <div class="panel panel-default">
        <div class="panel-heading">
          <h3 class="panel-title"><i class="fa fa-list"></i> 商品类型列表</h3>
        </div>
        <div class="panel-body">    
		<!--<div class="navbar navbar-default">-->
            <!--<div class="row navbar-form">-->
                <!--<button type="submit" onclick="location.href='{:U('Seller/GoodsTianxin/addEditGoodsType')}'"  class="btn btn-primary pull-right"><i class="fa fa-plus"></i>新增商品类型</button>-->
            <!--</div>-->
          <!--</div>-->
                        
          <div id="ajax_return"> 
                    <div class="table-responsive layui-border-box">
                        <table class="table table-bordered table-hover layui-table-box">
                            <thead>
                            <tr>
                                <th class="sorting text-center">ID</th>                                
                                <th class="sorting text-center">产品类型名<span style="font-weight: normal;">（如：扳手规格，手套规格..）</span></th>
                                <th class="sorting text-center">操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <volist name="goodsTypeList" id="list">
                                <tr>
                                    <td class="text-center">{$list.id}</td>
                                    <td class="text-center"><input  class="input-sm form-control"  style="width: 200px;" type="text" onchange="addtype(this,'{$list.id}')" value="{$list.name}"></td>
                                    <td class="text-center">
                                        <a href="{:U('Seller/GoodsTianxin/specList',array('goods_type_id'=>$list['id']))}" data-toggle="tooltip" title="" class="btn btn-info" data-original-title="属性列表"><i class="fa fa-eye"> 添加规格内容</i></a>
                                        <!--<a href="{:U('Seller/GoodsTianxin/addEditGoodsType',array('id'=>$list['id']))}" data-toggle="tooltip" title="" class="btn btn-primary" data-original-title="编辑"><i class="fa fa-pencil"></i></a>-->
                                        <a href="javascript:del_fun('{:U('Seller/GoodsTianxin/delGoodsType',array('id'=>$list['id']))}');" id="button-delete6" data-toggle="tooltip" title="" class="btn btn-danger" data-original-title="删除"><i class="fa fa-trash-o"></i> 删除</a>
                                    </td>
                                </tr>
                            </volist>
                            <tr>
                                <td class="text-center">请输入</td>
                                <td class="text-center">
                                    <input id="leixing" type="text" style="width: 200px"  placeholder="商品类型名称" class="input-sm form-control"  onchange="addtype(this,'')" value="" />
                                </td>
                                <td class="text-center"></td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                
                <div class="row">
                    <div class="col-sm-6 text-left"></div>
                    <div class="col-sm-6 text-right">{$show}</div>
                </div>
          
          </div>
        </div>
      </div>
    </div>
    <!-- /.row --> 
  </section>
  <!-- /.content --> 
</div>
<!-- /.content-wrapper --> 
</body>
</html>
<script>
    function addtype(obj,id)
    {
        var value = $(obj).val();
        $("#leixing").val('');
        $.ajax({
            type: "post",
            data:{name:value,id:id},
            url:"{:U('Seller/GoodsTianxin/addEditGoodsType')}",

            success: function(data){

                var obj =JSON.parse(data);
                if (obj.status == 1){
                    layer.msg(obj.msg, {icon:1});
                    setTimeout(function(){  //使用  setTimeout（）方法设定定时2000毫秒
                        window.location.reload();//页面刷新
                    },1000);
                }else{
                    layer.msg(obj.msg, {icon:2});
                }

            }

        });

    }
</script>